import java.sql.DriverManager;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import java.sql.ResultSet;

public class mysqldata {

    public static void main(String[] args) {
        try {

            //加载Connector/J驱动
            //这一句也可写为：Class.forName("com.mysql.jdbc.Driver");
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            //建立到MySQL的连接
            Connection conn = (Connection) DriverManager.getConnection("jdbc:http://192.168.8.6:8000/weibonews", "root", "");
            //执行SQL语句
            Statement stmt = (Statement) conn.createStatement();
            ResultSet result = (ResultSet) stmt.executeQuery("select * from cds");
            //处理结果集
            while (result.next()) {
                String aa = result.getString(1);
                String bb = result.getString(2);
                String cc = result.getString(3);
                String dd = result.getString(4);
                System.out.println(aa);
                System.out.println(bb);
                System.out.println(cc);
                System.out.println(dd);
                // System.out.println(" database connection  is success");
            }
            result.close();

        } catch (Exception ex) {
            System.out.println("Error : " + ex.toString());
        }
    }
}
